package ebcs.database.service.impl.sys;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.util.StringUtil;

import ebcs.database.bean.sys.PaAgency;
import ebcs.database.bean.sys.PaAgencyExample;
import ebcs.database.mybatis.dao.sys.PaAgencyMapper;
import ebcs.database.service.sys.IAgencyManagerService;

@Service
public class AgencyManagerServiceImpl implements IAgencyManagerService {

	@Autowired
	PaAgencyMapper agencyDao;

	@Override
	public int insert(PaAgency agency) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int logoutAgency(PaAgency agency) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updateAgencyInfor(PaAgency agency) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public PaAgency searchAgencyInforByAgenId(int agenid) { 
		
		return this.agencyDao.selectByPrimaryKey(agenid);
	}

	@Override
	public List<PaAgency> searchAgencyInfor(PaAgency agency) {
		PaAgencyExample agExample = new PaAgencyExample();
		PaAgencyExample.Criteria cta = agExample.createCriteria();
		if(StringUtil.isNotEmpty(agency.getName())) {
		cta.andNameLike("%"+agency.getName()+"%");
		}
		cta.andCancelstatusEqualTo(agency.getCancelstatus());
		// TODO Auto-generated method stub
		return this.agencyDao.selectByExample(agExample);
	}
	 
}
